package tmproject.hlhj.fhp.cartrans.activitys

import android.content.Intent
import kotlinx.android.synthetic.main.aty_exam_rule.*
import tmproject.hlhj.fhp.cartrans.BaseAty
import tmproject.hlhj.fhp.cartrans.IView.ExamRuleView
import tmproject.hlhj.fhp.cartrans.R
import tmproject.hlhj.fhp.cartrans.utils.WebUtils
import tmproject.hlhj.fhp.cartrans.javaBean.ExamRuleBean
import tmproject.hlhj.fhp.cartrans.presenter.ExamRulePresenter
import tmproject.hlhj.fhp.cartrans.utils.SpHelper

/**
 * Created by Administrator on 2018/8/28/028.
 */
class ExamRuleAty:BaseAty<ExamRuleView,ExamRulePresenter>(), ExamRuleView {
    override fun bindView(): ExamRuleView {
        return this
    }

    override fun createPresenter(): ExamRulePresenter {
        return ExamRulePresenter()
    }

    override fun getContentId(): Int {
        return R.layout.aty_exam_rule
    }

    override fun initView() {

        WebUtils.initWeb(webView,this)

    }

    override fun setRule(examRuleBean: ExamRuleBean) {
        WebUtils.loadUrl(webView,examRuleBean.data.remark)
    }
    override fun logicStart() {
        presenter?.getRule(this,SpHelper.getToken(this),intent.getIntExtra("id",-1))
    }

    override fun setListener() {
        btExit.setOnClickListener {
            finish()
        }
        btStart.setOnClickListener {
            val i = Intent(this, ExamDetailAty::class.java)
            i.putExtra("id",intent.getIntExtra("id",-1))
            startActivity(i)
            finish()
        }

    }
}